﻿using System;
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;

namespace CMView
{
	public partial class Login : UserControl
	{
		public Login()
		{
			InitializeComponent();
		}

		#region Properties ============================================================================

		[Category("Label")]
		public string UsernameLabel
		{
			get { return lblUsername.Content.ToString(); }
			set { lblUsername.Content = value; }
		}
		[Category("Label")]
		public string PasswordLabel
		{
			get { return lblPassword.Content.ToString(); }
			set { lblPassword.Content = value; }
		}

		[Category("Label")]
		public string LoginLabel
		{
			get { return btnLogin.Content.ToString(); }
			set { btnLogin.Content = value; }
		}

		[Category("Label")]
		public string ForgotPasswordLabel
		{
			get { return lblForgotPassword.Content.ToString(); }
			set { lblForgotPassword.Content = value; }
		}
		[Category("Label")]
		public string RegisterLabel
		{
			get { return lblRegister.Content.ToString(); }
			set { lblRegister.Content = value; }
		}

		[Category("Content")]
		public string Username
		{
			get { return tbxUsername.Text; }
			set { tbxUsername.Text = value; }
		}
		[Category("Content")]
		public string Password
		{
			get { return tbxPassword.Password; }
			set { tbxPassword.Password = value; }
		}

		#endregion Properties =========================================================================


		#region Methods ===============================================================================

		public void abc()
		{

		}

		#endregion Methods ============================================================================


		#region Events ================================================================================

		public event EventHandler LoginClick = null;
		protected void OnLoginClick() { if (LoginClick != null) LoginClick(this, EventArgs.Empty); }
		
		public event EventHandler ForgotPassword = null;
		protected void OnForgotPassword() { if (ForgotPassword != null) ForgotPassword(this, EventArgs.Empty); }

		public event EventHandler RegisterUser = null;
		protected void OnRegisterUser() { if (RegisterUser != null) RegisterUser(this, EventArgs.Empty); }

		#endregion Events =============================================================================


		#region Functions =============================================================================

		protected override void OnGotFocus(RoutedEventArgs e)
		{
			base.OnGotFocus(e);
			tbxUsername.Focus();
		}

		private void btnLogin_Click(object sender, RoutedEventArgs e)
		{
			OnLoginClick();
		}

		#endregion Functions ==========================================================================
	}
}